package com.uaroadshow.entity.user;

import org.apache.commons.lang3.StringUtils;

import com.demo2do.core.utils.Alias;

/**
 * 用户来源
 * 
 * @author wangliwang
 */
@Alias("UserSource")
public enum UserSource {

    uaroadshow_WECHAT_ACCOUNT("uaroadshow_wechat_account", "微信用户"),
    
    uaroadshow_MOBILE_ACCOUNT("uaroadshow_mobile_account", "手机用户"),
    
    uaroadshow_WEAPP_ACCOUNT("uaroadshow_weapp_account", "小程序用户");
    
    private String code;
    
    private String description;

    /**
     * @param code
     * @param description
     */
    private UserSource(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    /**
     * @param code
     * @return
     */
    public static UserSource codeOf(String code) {
        for(UserSource type : UserSource.values()) {
            if (StringUtils.equals(code, type.getCode())) {
                return type;
            }
        }
        return null;
    }
    
    /**
     * 
     * @param source
     * @return
     */
    public static boolean isWechatSource(String source) {
        
        return false;
    }

    /**
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }
    
}
